package com.example.propertymanagement.entity;

/**
 * CommunityStatus：小区的状态枚举类
 */
public enum CommunityStatus {
    ENABLED("启用"),
    DISABLED("禁用");

    private final String label;

    CommunityStatus(String label) {
        this.label = label;
    }

    public String getLabel() {
        return label;
    }

    // 根据数据库中的值返回对应的枚举
    public static CommunityStatus fromLabel(String label) {
        for (CommunityStatus status : values()) {
            if (status.getLabel().equals(label)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知状态: " + label);
    }
}
